/*
 ============================================================================
 Name		: MyDataCenter.h
 Author	  : 
 Version	 : 1.0
 Copyright   : copyright readever.cn
 2009-2010
 Description : CMyDataCenter declaration
 ============================================================================
 */

#ifndef MYDATACENTER_H
#define MYDATACENTER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>

#include <html\htmlcontrol.h> 
#include <html\htmlctlevent.h>
#include "hm\hm_listview.h"
#include "plugin.h"

// CLASS DECLARATION
class CAknAppUi;
class CHtmlControl;
class CStreamAudioEngine;
class c4_Storage;
/**
 *  CMyDataCenter
 * 
 */
class MyDataCenter : public CBase, public MHtmlCtlEventObserver
	{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~MyDataCenter();

	/**
	 * Two-phased constructor.
	 */
	static MyDataCenter* NewL();

	/**
	 * Two-phased constructor.
	 */
	static MyDataCenter* NewLC();
	void TestMe();
	void RenderListItemL(CHtmlElement* aElement, TInt aIndex);
private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	MyDataCenter();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL();
	void AddHistory(const TDesC& link);
	bool GoBack();	
	void LoadBook(const TDesC& dbname);
	void ParsePage(const TDesC& paras);
	bool ProcessLink(const TDesC& paras, bool addhistory = true);
public:
	void PlayMp3(const TDesC& media);
    void HandleBufImageLoadEventL(CBufferedImageDecoder* aDecoder, const TDesC& aFileName);	
	void HandleHtmlCtlEventL(const THtmlCtlEvent& aEvent);
	void Init(CHtmlControl* aHtmlControl, MPluginObserver* aObserver);
	void LoadMemPage(c4_Storage* store, const TDesC& path, bool addhistory = false);
	TKeyResponse SuperHandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );	
public:
	c4_Storage* iDBInfo;
	c4_Storage* iDBBook;
private:
	CDesCArrayFlat* iHistory;	
	CHtmlControl* iHtmlControl;	
	ChmListView iHmListView;
	c4_Storage* iDBStore;
	MPluginObserver* iObserver;
	CStreamAudioEngine* iMp3Stream;
	TBuf<128> iCurrentDBFile;
	};

#endif // MYDATACENTER_H
